<include file="public@header"/>
</head>
<body>
<div class="layui-fluid js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('AdminBranchCategory/index')}">分类管理</a></li>
        <li><a href="{:url('AdminBranchCategory/add')}">添加分类</a></li>
        <li class="active"><a>编辑分类</a></li>
    </ul>
    <div class="row margin-top-20">
        <div class="col-md-2">
            <div class="list-group">
                <a class="list-group-item on" href="#A" data-toggle="tab">基本属性</a>
                <!-- <a class="list-group-item" href="#B" data-toggle="tab">SEO设置</a> -->
                <a class="list-group-item" href="#C" data-toggle="tab">模板设置</a>
                <a class="list-group-item" href="#D" data-toggle="tab">图片相关</a>
            </div>
        </div>
        <div class="col-md-6">
            <form class="js-ajax-form" action="{:url('AdminBranchCategory/editPost')}" method="post">
                <div class="tab-content">
                    <div class="tab-pane active" id="A">
                        <div class="layui-form-item">
                            <label for="input-parent"><span class="form-required">*</span>上级</label>
                            <div>
                                <select class="layui-input" name="parent_id" id="input-parent">
                                    <option value="0">作为一级分类</option>
                                    {$categories_tree}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="input-name"><span class="form-required">*</span>分类名称</label>
                            <div>
                                <input type="text" class="layui-input" id="input-name" name="name" value="{$name}">
                            </div>
                        </div>
                        <!-- <div class="layui-form-item">
                            <label for="input-name">分类别名</label>
                            <div>
                                <input type="text" class="layui-input" id="input-alias" name="alias"
                                       value="{$alias|default=''}">
                            </div>
                        </div> -->
                        <div class="layui-form-item">
                            <label for="input-name">分类类型</label>
                            <div>
                                <select class="layui-input" name="taxonomy">
                                    {$taxonomys}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="input-parent">审核流程</label>
                            <div>
                                <select class="layui-input" name="audit_id" id="input-parent">
                                    <option value="0">请选择</option>
                                    {$audit_list}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="input-name">标题</label>
                            <div>
                                <input type="text" class="layui-input" id="input-alias" name="title" value="{$title|default=''}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="input-description">描述</label>
                            <div>
                                <!-- <textarea class="layui-input" name="description" id="input-description">{$description}</textarea> -->
                                <script type="text/plain" id="input-description" name="description">{$description}</script>
                            </div>
                        </div>
                        
                    </div>
                    <!-- <div class="tab-pane" id="B">
                        <div class="layui-form-item">
                            <label for="input-seo_title">SEO标题</label>
                            <div>
                                <input type="text" class="layui-input" id="input-seo_title" name="seo_title"
                                       value="{$seo_title}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="input-seo_keywords">SEO关键字</label>
                            <div>
                                <input type="text" class="layui-input" id="input-seo_keywords" name="seo_keywords"
                                       value="{$seo_keywords}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="input-seo_description">SEO描述</label>
                            <div>
                                <textarea class="layui-input" name="seo_description" id="input-seo_description">{$seo_description}</textarea>
                            </div>
                        </div>
                    </div> -->
                    <div class="tab-pane" id="C">
                        <!-- <div class="layui-form-item">
                            <label for="input-list_tpl"><span class="form-required">*</span>列表模板</label>
                            <div>
                                <select class="layui-input" name="list_tpl" id="input-list_tpl">
                                    <option value="list">portal/list.html(默认)</option>
                                    <foreach name="list_theme_files" item="vo">
                                        <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                        <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                    </foreach>
                                </select>
                            </div>
                        </div> -->
                        <div class="layui-form-item">
                            <label for="input-one_tpl"><span class="form-required">*</span>文章模板</label>
                            <div>
                                <select class="layui-input" name="one_tpl" id="input-one_tpl">
                                    <!--<option value="article">portal/article.html(默认)</option>-->
                                    <foreach name="article_theme_files" item="vo">
                                        <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                        <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                    </foreach>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="D">
                        <div class="layui-form-item">
                            <label>缩略图</label>
                            <div>
                                <input type="hidden" name="more[thumbnail]" class="layui-input"
                                       value="{$more.thumbnail|default=''}" id="js-thumbnail-input">
                                <div>
                                    <a href="javascript:uploadOneImage('图片上传','#js-thumbnail-input');">
                                        <if condition="empty($more.thumbnail)">
                                            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                 id="js-thumbnail-input-preview"
                                                 width="135" style="cursor: pointer"/>
                                            <else/>
                                            <img src="{:cmf_get_image_preview_url($more.thumbnail)}"
                                                 id="js-thumbnail-input-preview"
                                            width="135" style="cursor: pointer"/>
                                        </if>
                                    </a>
                                    <input type="button" class="btn btn-sm" onclick="$('#js-thumbnail-input-preview').attr('src','__TMPL__/public/assets/images/default-thumbnail.png');$('#js-thumbnail-input').val('');return false;" value="取消图片">
                                    <br>
                                    <eq name="parent_id" value="46">
                                        推荐尺寸 692px * 349px
                                        <br>
                                        当该分类排序为最前时(从小到大) 推荐尺寸 692px * 722px
                                    </eq>
                                </div>
                            </div>
                        </div>

                        <!-- <div class="layui-form-item">
                            <label for="input-slide"><span class="form-required">*</span>banner图</label>
                            <div>
                                <select class="layui-input" name="slide_id" id="input-slide">
                                    <option value="0">默认分类</option>
                                    <foreach name="slide" item="vo">
                                        <php>$cid_selected=$slide_id==$vo['id']?"selected":"";</php>
                                        <option value="{$vo.id}"{$cid_selected}>{$vo.name}</option>
                                    </foreach>
                                </select>
                                <span class="layui-word-aux">可前往扩展工具下的幻灯片分类进行添加</span>
                            </div>
                        </div> -->

                        <div class="layui-form-item">
                            <label for="input-thumb_size"><span class="form-required">*</span>缩略图尺寸</label>
                            <div>
                                <input type="text" class="layui-input" id="input-thumb_size" name="thumb_size" value="{$thumb_size}">
                                <span class="layui-word-aux">该分类下的文章缩略图推荐尺寸</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <input type="hidden" name="id" value="{$id}">
                    <button type="submit" class="layui-btn layui-btn-normal js-ajax-submit" data-refresh="0">{:lang('SAVE')}
                    </button>
                    <a class="btn btn-default" href="{:url('AdminBranchCategory/index')}">{:lang('BACK')}</a>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>

<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    $('#input-list_tpl').val("{$list_tpl|default=''}");
    $('#input-one_tpl').val("{$one_tpl|default=''}");
    $(function () {
        //编辑器
        if( $('#input-description').length ){
            var editor = UE.getEditor('input-description',{  
                //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个  
                toolbars:[['fullscreen', 'source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'backcolor', 'fontsize', 'fontfamily', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'strikethrough', 'removeformat', 'autotypeset', 'pasteplain', '|', 'forecolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', 'link', 'unlink']],
                //关闭字数统计  
                wordCount:false,  
                //关闭elementPath  
                elementPathEnabled:false,  
                //默认的编辑区域高度  
                initialFrameHeight:200,
                initialFrameWidth:'100%',
            });
        }

    });
</script>
</body>
</html>
